Skip to content

NXP backend: Add quantization of aten.view #11784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

robert-kalmar
Copy link
Collaborator

@robert-kalmar robert-kalmar commented Jun 18, 2025

Summary

Updates part of this PR:

  • Add support for quantization and conversion of the aten.view operator to Neutron Backend.
  • Fix avegage pooling, which in case of kernel (1,1) turns into Sum in Neutron IR.

Test plan

Unit test part of the change.

pytest -c /dev/null backends/nxp/tests/

cc @digantdesai @JakeStevens

Copy link

pytorch-bot bot commented Jun 18, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11784

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 Cancelled Jobs

As of commit cf1aa3c with merge base 75e4044 (image):

CANCELLED JOBS - The following jobs were cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 18, 2025
@robert-kalmar robert-kalmar added module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate labels Jun 18, 2025
@JakeStevens
Copy link
Contributor

nit: can you split this diff? It seems to be two completely separate changes, aten view quantization and the removal of avg pool/linear optimization

@StrycekSimon StrycekSimon force-pushed the upstream/main-nxp/EIEX-300-upstream-aten.view-support branch from c30ba16 to f5c779e Compare June 25, 2025 13:57
@StrycekSimon StrycekSimon force-pushed the upstream/main-nxp/EIEX-300-upstream-aten.view-support branch from f5c779e to cf1aa3c Compare July 1, 2025 06:49
@robert-kalmar robert-kalmar marked this pull request as ready for review July 8, 2025 09:57
@JakeStevens
Copy link
Contributor

LGTM

@@ -164,9 +160,6 @@ def __init__(
Optimization.COMBINE_HARD_SIGMOID_AND_MUL_INTO_HARD_SWISH: CombineHardSigmoidAndMulIntoHardSwish(
builder, conversion_config
),
Optimization.REPLACE_AVERAGE_POOL_BEFORE_FULLY_CONNECTED_WITH_SUM: ReplaceAveragePoolBeforeFullyConnectedWithSum(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related to the view support?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, not related to aten.view. Our fault.
It is indeed a separate commit, and the PR descrition should have included the proper description:
"Fix avegage pooling, which in case of kernel (1,1) turns into Sum in Neutron IR"

At least added in to the PR description.

@@ -47,37 +39,6 @@ def test_constant_pad_nd_conversion__specific_constant(constant):
convert_run_compare(edge_program, input_data)


@pytest.mark.parametrize("constant", [0.0, 67.28, 42.0, -13.37])
@pytest.mark.skip(reason="Neutron Converter does not fully convert for NPU")
def test_constant_pad_nd_quant_conversion__specific_constant(mocker, constant):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this should have been a separate PR to remove irrelevant test. We will pay more attention when rebasing from our development tree.

@digantdesai digantdesai merged commit bc33d47 into pytorch:main Jul 10, 2025
193 of 196 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants